<?php
class prepaModel{	
	function __construct(){
		try {
                    global $username,$password,$MySQLServer,$db;
                    $this->con = mysql_connect($MySQLServer, $username, $password) or die(mysql_error());
                    mysql_select_db($db) or die(mysql_error());
                } catch (Exception $ex) {
                    $this->error($ex);
                }			
	}

	public function reportados($nomina){
             $result = mysql_query("SELECT *
                            FROM reportes_prepa.reporte
                            INNER JOIN reportes_prepa.alumno
                            ON reportes_prepa.reporte.Matricula = reportes_prepa.alumno.Matricula
                            INNER JOIN reportes_prepa.docente
                            ON reportes_prepa.docente.Nomina = reportes_prepa.reporte.Nomina
                            WHERE reportes_prepa.alumno.Nomina='$nomina'
                            ORDER BY reportes_prepa.reporte.Matricula ASC");
                            echo mysql_error();    
                return $result;
        }
        public function sinRepetir($nomina){
             $result = mysql_query("SELECT reportes_prepa.reporte.Matricula
                            FROM reportes_prepa.reporte
                            INNER JOIN reportes_prepa.alumno
                            ON reportes_prepa.reporte.Matricula = reportes_prepa.alumno.Matricula
                            WHERE reportes_prepa.alumno.Nomina='$nomina'
                            GROUP BY Matricula
                            ORDER BY reportes_prepa.reporte.Matricula ASC");
                            echo mysql_error();    
                return $result;
                
	}
        
        public function reportadosGral(){
             $result = mysql_query("SELECT *
                            FROM reportes_prepa.reporte
                            INNER JOIN reportes_prepa.alumno
                            ON reportes_prepa.reporte.Matricula = reportes_prepa.alumno.Matricula
                            INNER JOIN reportes_prepa.docente
                            ON reportes_prepa.docente.Nomina = reportes_prepa.reporte.Nomina
                            ORDER BY reportes_prepa.reporte.Matricula ASC");
                            echo mysql_error();    
                return $result;
        }
           public function sinRepetirGral(){
             $result = mysql_query("SELECT reportes_prepa.reporte.Matricula
                            FROM reportes_prepa.reporte
                            GROUP BY Matricula
                            ORDER BY reportes_prepa.reporte.Matricula ASC");
                            echo mysql_error();    
                return $result;
                
	}
        
        function close() {
            mysql_close($this->con);
        }
        
}

?>